package financial.sharing.center.common.enums;

/**
 * @ClassName InvoiceTypeEnum
 * @Description TODO
 * @Author guoyuhang
 * @ @csdn https://blog.csdn.net/qq_40788718
 * @Date 2021/4/12
 * @Version 1.0
 */
public enum InvoiceTypeEnum {

    无("无", 0),
    增值税专用发票("增值税专用发票", 1),
    增值税普通发票("增值税普通发票", 2);

    private final String name;
    private final Integer value;

    InvoiceTypeEnum(String name, Integer value) {
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return this.name;
    }

    public Integer getValue() {
        return this.value;
    }

    public static InvoiceTypeEnum name2Enum(String value) {
        for (InvoiceTypeEnum enumName : InvoiceTypeEnum.values()) {
            if(enumName.getName().equals(value)) {
                return enumName;
            }
        }
        return null;
    }

    public static InvoiceTypeEnum int2Enum(Integer value) {
        for (InvoiceTypeEnum enumName : InvoiceTypeEnum.values()) {
            if(enumName.getValue().equals(value)) {
                return enumName;
            }
        }
        return null;
    }
}
